﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeReborn.Classes
{
    public static class ScreenScraping
    {
        static public System.Drawing.Color GetPixelColor(int x, int y)
        {
            IntPtr hdc = WinAPI.GetDC(IntPtr.Zero);
            uint pixel = WinAPI.GetPixel(hdc, x, y);
            WinAPI.ReleaseDC(IntPtr.Zero, hdc);
            Color color = Color.FromArgb((int)(pixel & 0x000000FF),
                         (int)(pixel & 0x0000FF00) >> 8,
                         (int)(pixel & 0x00FF0000) >> 16);
            return color;
        }

        public static Point GetCursorPosition()
        {
            WinAPI.POINT lpPoint;
            WinAPI.GetCursorPos(out lpPoint);
            
            return lpPoint;
        }
    }
}
